﻿/**  版本信息模板在安装目录下，可自行修改。
* T_PackingListDetails.cs
*
* 功 能： N/A
* 类 名： T_PackingListDetails
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2017/5/8 星期一 下午 10:35:02   N/A    初版
*
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
*┌──────────────────────────────────┐
*│　此技术信息为本公司机密信息，未经本公司书面同意禁止向第三方披露．　│
*│　版权所有：动软卓越（北京）科技有限公司　　　　　　　　　　　　　　│
*└──────────────────────────────────┘
*/
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using SYDZ.WMS.DBUtility;
namespace WMSAML.Warehouse.DAL
{
    /// <summary>
    /// 数据访问类:T_PackingListDetails
    /// </summary>
    public partial class T_PackingListDetails
    {
        public T_PackingListDetails()
        { }
        #region  BasicMethod



        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WMSAML.Warehouse.Model.T_PackingListDetails model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into T_PackingListDetails(");
            strSql.Append("Destination,ProDate,pick_UserNO,packinglistmain_no,PC_Order_No,Panasonic,Customer,Pallet_No,Pallet_Qty,Qty_PA,TTL_Qty,Price,Amount,L,W,H,Total_NW,Total_GW,Total_VOL,L2,W2,H2,NW2,GW2,Create_Time,Update_Time,Update_user_id,Status,BK01,BK02,BK03,BK04,BK05)");
            strSql.Append(" values (");
            strSql.Append("@Destination,@ProDate,@pick_UserNO,@packinglistmain_no,@PC_Order_No,@Panasonic,@Customer,@Pallet_No,@Pallet_Qty,@Qty_PA,@TTL_Qty,@Price,@Amount,@L,@W,@H,@Total_NW,@Total_GW,@Total_VOL,@L2,@W2,@H2,@NW2,@GW2,@Create_Time,@Update_Time,@Update_user_id,@Status,@BK01,@BK02,@BK03,@BK04,@BK05)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@Destination", SqlDbType.VarChar,50),
					new SqlParameter("@ProDate", SqlDbType.VarChar,50),
					new SqlParameter("@pick_UserNO", SqlDbType.VarChar,50),
					new SqlParameter("@packinglistmain_no", SqlDbType.VarChar,50),
					new SqlParameter("@PC_Order_No", SqlDbType.NVarChar,200),
					new SqlParameter("@Panasonic", SqlDbType.NVarChar,200),
					new SqlParameter("@Customer", SqlDbType.NVarChar,200),
					new SqlParameter("@Pallet_No", SqlDbType.Int,4),
					new SqlParameter("@Pallet_Qty", SqlDbType.Int,4),
					new SqlParameter("@Qty_PA", SqlDbType.Int,4),
					new SqlParameter("@TTL_Qty", SqlDbType.Int,4),
					new SqlParameter("@Price", SqlDbType.Decimal,9),
					new SqlParameter("@Amount", SqlDbType.Decimal,9),
					new SqlParameter("@L", SqlDbType.Decimal,9),
					new SqlParameter("@W", SqlDbType.Decimal,9),
					new SqlParameter("@H", SqlDbType.Decimal,9),
					new SqlParameter("@Total_NW", SqlDbType.Decimal,9),
					new SqlParameter("@Total_GW", SqlDbType.Decimal,9),
					new SqlParameter("@Total_VOL", SqlDbType.Decimal,9),
					new SqlParameter("@L2", SqlDbType.Decimal,9),
					new SqlParameter("@W2", SqlDbType.Decimal,9),
					new SqlParameter("@H2", SqlDbType.Decimal,9),
					new SqlParameter("@NW2", SqlDbType.Decimal,9),
					new SqlParameter("@GW2", SqlDbType.Decimal,9),
					new SqlParameter("@Create_Time", SqlDbType.NVarChar,200),
					new SqlParameter("@Update_Time", SqlDbType.NVarChar,200),
					new SqlParameter("@Update_user_id", SqlDbType.VarChar,200),
					new SqlParameter("@Status", SqlDbType.NVarChar,200),
					new SqlParameter("@BK01", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK02", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK03", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK04", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK05", SqlDbType.NVarChar,-1)};
            parameters[0].Value = model.Destination;
            parameters[1].Value = model.ProDate;
            parameters[2].Value = model.pick_UserNO;
            parameters[3].Value = model.packinglistmain_no;
            parameters[4].Value = model.PC_Order_No;
            parameters[5].Value = model.Panasonic;
            parameters[6].Value = model.Customer;
            parameters[7].Value = model.Pallet_No;
            parameters[8].Value = model.Pallet_Qty;
            parameters[9].Value = model.Qty_PA;
            parameters[10].Value = model.TTL_Qty;
            parameters[11].Value = model.Price;
            parameters[12].Value = model.Amount;
            parameters[13].Value = model.L;
            parameters[14].Value = model.W;
            parameters[15].Value = model.H;
            parameters[16].Value = model.Total_NW;
            parameters[17].Value = model.Total_GW;
            parameters[18].Value = model.Total_VOL;
            parameters[19].Value = model.L2;
            parameters[20].Value = model.W2;
            parameters[21].Value = model.H2;
            parameters[22].Value = model.NW2;
            parameters[23].Value = model.GW2;
            parameters[24].Value = model.Create_Time;
            parameters[25].Value = model.Update_Time;
            parameters[26].Value = model.Update_user_id;
            parameters[27].Value = model.Status;
            parameters[28].Value = model.BK01;
            parameters[29].Value = model.BK02;
            parameters[30].Value = model.BK03;
            parameters[31].Value = model.BK04;
            parameters[32].Value = model.BK05;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WMSAML.Warehouse.Model.T_PackingListDetails model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_PackingListDetails set ");
            strSql.Append("Destination=@Destination,");
            strSql.Append("ProDate=@ProDate,");
            strSql.Append("pick_UserNO=@pick_UserNO,");
            strSql.Append("packinglistmain_no=@packinglistmain_no,");
            strSql.Append("PC_Order_No=@PC_Order_No,");
            strSql.Append("Panasonic=@Panasonic,");
            strSql.Append("Customer=@Customer,");
            strSql.Append("Pallet_No=@Pallet_No,");
            strSql.Append("Pallet_Qty=@Pallet_Qty,");
            strSql.Append("Qty_PA=@Qty_PA,");
            strSql.Append("TTL_Qty=@TTL_Qty,");
            strSql.Append("Price=@Price,");
            strSql.Append("Amount=@Amount,");
            strSql.Append("L=@L,");
            strSql.Append("W=@W,");
            strSql.Append("H=@H,");
            strSql.Append("Total_NW=@Total_NW,");
            strSql.Append("Total_GW=@Total_GW,");
            strSql.Append("Total_VOL=@Total_VOL,");
            strSql.Append("L2=@L2,");
            strSql.Append("W2=@W2,");
            strSql.Append("H2=@H2,");
            strSql.Append("NW2=@NW2,");
            strSql.Append("GW2=@GW2,");
            strSql.Append("Create_Time=@Create_Time,");
            strSql.Append("Update_Time=@Update_Time,");
            strSql.Append("Update_user_id=@Update_user_id,");
            strSql.Append("Status=@Status,");
            strSql.Append("BK01=@BK01,");
            strSql.Append("BK02=@BK02,");
            strSql.Append("BK03=@BK03,");
            strSql.Append("BK04=@BK04,");
            strSql.Append("BK05=@BK05");
            strSql.Append(" where PackingListDetails_Id=@PackingListDetails_Id");
            SqlParameter[] parameters = {
					new SqlParameter("@Destination", SqlDbType.VarChar,50),
					new SqlParameter("@ProDate", SqlDbType.VarChar,50),
					new SqlParameter("@pick_UserNO", SqlDbType.VarChar,50),
					new SqlParameter("@packinglistmain_no", SqlDbType.VarChar,50),
					new SqlParameter("@PC_Order_No", SqlDbType.NVarChar,200),
					new SqlParameter("@Panasonic", SqlDbType.NVarChar,200),
					new SqlParameter("@Customer", SqlDbType.NVarChar,200),
					new SqlParameter("@Pallet_No", SqlDbType.Int,4),
					new SqlParameter("@Pallet_Qty", SqlDbType.Int,4),
					new SqlParameter("@Qty_PA", SqlDbType.Int,4),
					new SqlParameter("@TTL_Qty", SqlDbType.Int,4),
					new SqlParameter("@Price", SqlDbType.Decimal,9),
					new SqlParameter("@Amount", SqlDbType.Decimal,9),
					new SqlParameter("@L", SqlDbType.Decimal,9),
					new SqlParameter("@W", SqlDbType.Decimal,9),
					new SqlParameter("@H", SqlDbType.Decimal,9),
					new SqlParameter("@Total_NW", SqlDbType.Decimal,9),
					new SqlParameter("@Total_GW", SqlDbType.Decimal,9),
					new SqlParameter("@Total_VOL", SqlDbType.Decimal,9),
					new SqlParameter("@L2", SqlDbType.Decimal,9),
					new SqlParameter("@W2", SqlDbType.Decimal,9),
					new SqlParameter("@H2", SqlDbType.Decimal,9),
					new SqlParameter("@NW2", SqlDbType.Decimal,9),
					new SqlParameter("@GW2", SqlDbType.Decimal,9),
					new SqlParameter("@Create_Time", SqlDbType.NVarChar,200),
					new SqlParameter("@Update_Time", SqlDbType.NVarChar,200),
					new SqlParameter("@Update_user_id", SqlDbType.VarChar,200),
					new SqlParameter("@Status", SqlDbType.NVarChar,200),
					new SqlParameter("@BK01", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK02", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK03", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK04", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK05", SqlDbType.NVarChar,-1),
					new SqlParameter("@PackingListDetails_Id", SqlDbType.Int,4)};
            parameters[0].Value = model.Destination;
            parameters[1].Value = model.ProDate;
            parameters[2].Value = model.pick_UserNO;
            parameters[3].Value = model.packinglistmain_no;
            parameters[4].Value = model.PC_Order_No;
            parameters[5].Value = model.Panasonic;
            parameters[6].Value = model.Customer;
            parameters[7].Value = model.Pallet_No;
            parameters[8].Value = model.Pallet_Qty;
            parameters[9].Value = model.Qty_PA;
            parameters[10].Value = model.TTL_Qty;
            parameters[11].Value = model.Price;
            parameters[12].Value = model.Amount;
            parameters[13].Value = model.L;
            parameters[14].Value = model.W;
            parameters[15].Value = model.H;
            parameters[16].Value = model.Total_NW;
            parameters[17].Value = model.Total_GW;
            parameters[18].Value = model.Total_VOL;
            parameters[19].Value = model.L2;
            parameters[20].Value = model.W2;
            parameters[21].Value = model.H2;
            parameters[22].Value = model.NW2;
            parameters[23].Value = model.GW2;
            parameters[24].Value = model.Create_Time;
            parameters[25].Value = model.Update_Time;
            parameters[26].Value = model.Update_user_id;
            parameters[27].Value = model.Status;
            parameters[28].Value = model.BK01;
            parameters[29].Value = model.BK02;
            parameters[30].Value = model.BK03;
            parameters[31].Value = model.BK04;
            parameters[32].Value = model.BK05;
            parameters[33].Value = model.PackingListDetails_Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update1(WMSAML.Warehouse.Model.T_PackingListDetails model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update T_PackingListDetails set ");
            strSql.Append("Destination=@Destination,");
            strSql.Append("ProDate=@ProDate,");
            strSql.Append("pick_UserNO=@pick_UserNO,");
            strSql.Append("packinglistmain_no=@packinglistmain_no,");
            strSql.Append("PC_Order_No=@PC_Order_No,");
            strSql.Append("Panasonic=@Panasonic,");
            strSql.Append("Customer=@Customer,");
            strSql.Append("Pallet_No=@Pallet_No,");
            strSql.Append("Pallet_Qty=@Pallet_Qty,");
            strSql.Append("Qty_PA=@Qty_PA,");
            strSql.Append("TTL_Qty=@TTL_Qty,");
            strSql.Append("Price=@Price,");
            strSql.Append("Amount=@Amount,");
            strSql.Append("L=@L,");
            strSql.Append("W=@W,");
            strSql.Append("H=@H,");
            strSql.Append("Total_NW=@Total_NW,");
            strSql.Append("Total_GW=@Total_GW,");
            strSql.Append("Total_VOL=@Total_VOL,");
            strSql.Append("L2=@L2,");
            strSql.Append("W2=@W2,");
            strSql.Append("H2=@H2,");
            strSql.Append("NW2=@NW2,");
            strSql.Append("GW2=@GW2,");
            strSql.Append("Create_Time=@Create_Time,");
            strSql.Append("Update_Time=@Update_Time,");
            strSql.Append("Update_user_id=@Update_user_id,");
            strSql.Append("Status=@Status,");
            strSql.Append("BK01=@BK01,");
            strSql.Append("BK02=@BK02,");
            strSql.Append("BK03=@BK03,");
            strSql.Append("BK04=@BK04,");
            strSql.Append("BK05=@BK05");
            strSql.Append(" where ");
            strSql.Append(" ProDate=@ProDate1");
            strSql.Append(" and packinglistmain_no=@packinglistmain_no1 ");
            strSql.Append(" and PC_Order_No=@PC_Order_No1 ");
            strSql.Append(" and Customer=@Customer1");
            strSql.Append(" and Pallet_No=@Pallet_No1 ");
            SqlParameter[] parameters = {
					new SqlParameter("@Destination", SqlDbType.VarChar,50),
					new SqlParameter("@ProDate", SqlDbType.VarChar,50),
					new SqlParameter("@pick_UserNO", SqlDbType.VarChar,50),
					new SqlParameter("@packinglistmain_no", SqlDbType.VarChar,50),
					new SqlParameter("@PC_Order_No", SqlDbType.NVarChar,200),
					new SqlParameter("@Panasonic", SqlDbType.NVarChar,200),
					new SqlParameter("@Customer", SqlDbType.NVarChar,200),
					new SqlParameter("@Pallet_No", SqlDbType.Int,4),
					new SqlParameter("@Pallet_Qty", SqlDbType.Int,4),
					new SqlParameter("@Qty_PA", SqlDbType.Int,4),
					new SqlParameter("@TTL_Qty", SqlDbType.Int,4),
					new SqlParameter("@Price", SqlDbType.Decimal,9),
					new SqlParameter("@Amount", SqlDbType.Decimal,9),
					new SqlParameter("@L", SqlDbType.Decimal,9),
					new SqlParameter("@W", SqlDbType.Decimal,9),
					new SqlParameter("@H", SqlDbType.Decimal,9),
					new SqlParameter("@Total_NW", SqlDbType.Decimal,9),
					new SqlParameter("@Total_GW", SqlDbType.Decimal,9),
					new SqlParameter("@Total_VOL", SqlDbType.Decimal,9),
					new SqlParameter("@L2", SqlDbType.Decimal,9),
					new SqlParameter("@W2", SqlDbType.Decimal,9),
					new SqlParameter("@H2", SqlDbType.Decimal,9),
					new SqlParameter("@NW2", SqlDbType.Decimal,9),
					new SqlParameter("@GW2", SqlDbType.Decimal,9),
					new SqlParameter("@Create_Time", SqlDbType.NVarChar,200),
					new SqlParameter("@Update_Time", SqlDbType.NVarChar,200),
					new SqlParameter("@Update_user_id", SqlDbType.VarChar,200),
					new SqlParameter("@Status", SqlDbType.NVarChar,200),
					new SqlParameter("@BK01", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK02", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK03", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK04", SqlDbType.NVarChar,-1),
					new SqlParameter("@BK05", SqlDbType.NVarChar,-1),
					new SqlParameter("@ProDate1", SqlDbType.VarChar,50),
                    new SqlParameter("@packinglistmain_no1", SqlDbType.VarChar,50),
                  	new SqlParameter("@PC_Order_No1", SqlDbType.NVarChar,200),
                    	new SqlParameter("@Customer1", SqlDbType.NVarChar,200),
                        new SqlParameter("@Pallet_No1", SqlDbType.Int,4)
                                 
                                        };
            parameters[0].Value = model.Destination;
            parameters[1].Value = model.ProDate;
            parameters[2].Value = model.pick_UserNO;
            parameters[3].Value = model.packinglistmain_no;
            parameters[4].Value = model.PC_Order_No;
            parameters[5].Value = model.Panasonic;
            parameters[6].Value = model.Customer;
            parameters[7].Value = model.Pallet_No;
            parameters[8].Value = model.Pallet_Qty;
            parameters[9].Value = model.Qty_PA;
            parameters[10].Value = model.TTL_Qty;
            parameters[11].Value = model.Price;
            parameters[12].Value = model.Amount;
            parameters[13].Value = model.L;
            parameters[14].Value = model.W;
            parameters[15].Value = model.H;
            parameters[16].Value = model.Total_NW;
            parameters[17].Value = model.Total_GW;
            parameters[18].Value = model.Total_VOL;
            parameters[19].Value = model.L2;
            parameters[20].Value = model.W2;
            parameters[21].Value = model.H2;
            parameters[22].Value = model.NW2;
            parameters[23].Value = model.GW2;
            parameters[24].Value = model.Create_Time;
            parameters[25].Value = model.Update_Time;
            parameters[26].Value = model.Update_user_id;
            parameters[27].Value = model.Status;
            parameters[28].Value = model.BK01;
            parameters[29].Value = model.BK02;
            parameters[30].Value = model.BK03;
            parameters[31].Value = model.BK04;
            parameters[32].Value = model.BK05;
            parameters[33].Value = model.ProDate;
            parameters[34].Value = model.packinglistmain_no;
            parameters[35].Value = model.PC_Order_No;
            parameters[36].Value = model.Customer;
            parameters[37].Value = model.Pallet_No;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int PackingListDetails_Id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_PackingListDetails ");
            strSql.Append(" where PackingListDetails_Id=@PackingListDetails_Id");
            SqlParameter[] parameters = {
					new SqlParameter("@PackingListDetails_Id", SqlDbType.Int,4)
			};
            parameters[0].Value = PackingListDetails_Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete1(int PackingListDetails_Id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_PackingListDetails ");
            strSql.Append(" where bk04=@PackingListDetails_Id");
            SqlParameter[] parameters = {
					new SqlParameter("@PackingListDetails_Id", SqlDbType.Int,4)
			};
            parameters[0].Value = PackingListDetails_Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string PackingListDetails_Idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from T_PackingListDetails ");
            strSql.Append(" where PackingListDetails_Id in (" + PackingListDetails_Idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WMSAML.Warehouse.Model.T_PackingListDetails GetModel(int PackingListDetails_Id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 PackingListDetails_Id,Destination,ProDate,pick_UserNO,packinglistmain_no,PC_Order_No,Panasonic,Customer,Pallet_No,Pallet_Qty,Qty_PA,TTL_Qty,Price,Amount,L,W,H,Total_NW,Total_GW,Total_VOL,L2,W2,H2,NW2,GW2,Create_Time,Update_Time,Update_user_id,Status,BK01,BK02,BK03,BK04,BK05 from T_PackingListDetails ");
            strSql.Append(" where PackingListDetails_Id=@PackingListDetails_Id");
            SqlParameter[] parameters = {
					new SqlParameter("@PackingListDetails_Id", SqlDbType.Int,4)
			};
            parameters[0].Value = PackingListDetails_Id;

            WMSAML.Warehouse.Model.T_PackingListDetails model = new WMSAML.Warehouse.Model.T_PackingListDetails();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WMSAML.Warehouse.Model.T_PackingListDetails DataRowToModel(DataRow row)
        {
            WMSAML.Warehouse.Model.T_PackingListDetails model = new WMSAML.Warehouse.Model.T_PackingListDetails();
            if (row != null)
            {
                if (row["PackingListDetails_Id"] != null && row["PackingListDetails_Id"].ToString() != "")
                {
                    model.PackingListDetails_Id = int.Parse(row["PackingListDetails_Id"].ToString());
                }
                if (row["Destination"] != null)
                {
                    model.Destination = row["Destination"].ToString();
                }
                if (row["ProDate"] != null)
                {
                    model.ProDate = row["ProDate"].ToString();
                }
                if (row["pick_UserNO"] != null)
                {
                    model.pick_UserNO = row["pick_UserNO"].ToString();
                }
                if (row["packinglistmain_no"] != null)
                {
                    model.packinglistmain_no = row["packinglistmain_no"].ToString();
                }
                if (row["PC_Order_No"] != null)
                {
                    model.PC_Order_No = row["PC_Order_No"].ToString();
                }
                if (row["Panasonic"] != null)
                {
                    model.Panasonic = row["Panasonic"].ToString();
                }
                if (row["Customer"] != null)
                {
                    model.Customer = row["Customer"].ToString();
                }
                if (row["Pallet_No"] != null && row["Pallet_No"].ToString() != "")
                {
                    model.Pallet_No = int.Parse(row["Pallet_No"].ToString());
                }
                if (row["Pallet_Qty"] != null && row["Pallet_Qty"].ToString() != "")
                {
                    model.Pallet_Qty = int.Parse(row["Pallet_Qty"].ToString());
                }
                if (row["Qty_PA"] != null && row["Qty_PA"].ToString() != "")
                {
                    model.Qty_PA = int.Parse(row["Qty_PA"].ToString());
                }
                if (row["TTL_Qty"] != null && row["TTL_Qty"].ToString() != "")
                {
                    model.TTL_Qty = int.Parse(row["TTL_Qty"].ToString());
                }
                if (row["Price"] != null && row["Price"].ToString() != "")
                {
                    model.Price = decimal.Parse(row["Price"].ToString());
                }
                if (row["Amount"] != null && row["Amount"].ToString() != "")
                {
                    model.Amount = decimal.Parse(row["Amount"].ToString());
                }
                if (row["L"] != null && row["L"].ToString() != "")
                {
                    model.L = decimal.Parse(row["L"].ToString());
                }
                if (row["W"] != null && row["W"].ToString() != "")
                {
                    model.W = decimal.Parse(row["W"].ToString());
                }
                if (row["H"] != null && row["H"].ToString() != "")
                {
                    model.H = decimal.Parse(row["H"].ToString());
                }
                if (row["Total_NW"] != null && row["Total_NW"].ToString() != "")
                {
                    model.Total_NW = decimal.Parse(row["Total_NW"].ToString());
                }
                if (row["Total_GW"] != null && row["Total_GW"].ToString() != "")
                {
                    model.Total_GW = decimal.Parse(row["Total_GW"].ToString());
                }
                if (row["Total_VOL"] != null && row["Total_VOL"].ToString() != "")
                {
                    model.Total_VOL = decimal.Parse(row["Total_VOL"].ToString());
                }
                if (row["L2"] != null && row["L2"].ToString() != "")
                {
                    model.L2 = decimal.Parse(row["L2"].ToString());
                }
                if (row["W2"] != null && row["W2"].ToString() != "")
                {
                    model.W2 = decimal.Parse(row["W2"].ToString());
                }
                if (row["H2"] != null && row["H2"].ToString() != "")
                {
                    model.H2 = decimal.Parse(row["H2"].ToString());
                }
                if (row["NW2"] != null && row["NW2"].ToString() != "")
                {
                    model.NW2 = decimal.Parse(row["NW2"].ToString());
                }
                if (row["GW2"] != null && row["GW2"].ToString() != "")
                {
                    model.GW2 = decimal.Parse(row["GW2"].ToString());
                }
                if (row["Create_Time"] != null)
                {
                    model.Create_Time = row["Create_Time"].ToString();
                }
                if (row["Update_Time"] != null)
                {
                    model.Update_Time = row["Update_Time"].ToString();
                }
                if (row["Update_user_id"] != null)
                {
                    model.Update_user_id = row["Update_user_id"].ToString();
                }
                if (row["Status"] != null)
                {
                    model.Status = row["Status"].ToString();
                }
                if (row["BK01"] != null)
                {
                    model.BK01 = row["BK01"].ToString();
                }
                if (row["BK02"] != null)
                {
                    model.BK02 = row["BK02"].ToString();
                }
                if (row["BK03"] != null)
                {
                    model.BK03 = row["BK03"].ToString();
                }
                if (row["BK04"] != null)
                {
                    model.BK04 = row["BK04"].ToString();
                }
                if (row["BK05"] != null)
                {
                    model.BK05 = row["BK05"].ToString();
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select PackingListDetails_Id,Destination,ProDate,pick_UserNO,packinglistmain_no,PC_Order_No,Panasonic,Customer,Pallet_No,Pallet_Qty,Qty_PA,TTL_Qty,Price,Amount,L,W,H,Total_NW,Total_GW,Total_VOL,L2,W2,H2,NW2,GW2,Create_Time,Update_Time,Update_user_id,Status,BK01,BK02,BK03,BK04,BK05 ");
            strSql.Append(" FROM T_PackingListDetails ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" PackingListDetails_Id,Destination,ProDate,pick_UserNO,packinglistmain_no,PC_Order_No,Panasonic,Customer,Pallet_No,Pallet_Qty,Qty_PA,TTL_Qty,Price,Amount,L,W,H,Total_NW,Total_GW,Total_VOL,L2,W2,H2,NW2,GW2,Create_Time,Update_Time,Update_user_id,Status,BK01,BK02,BK03,BK04,BK05 ");
            strSql.Append(" FROM T_PackingListDetails ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM T_PackingListDetails ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.PackingListDetails_Id desc");
            }
            strSql.Append(")AS Row, T.*  from T_PackingListDetails T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "T_PackingListDetails";
            parameters[1].Value = "PackingListDetails_Id";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}

